<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
	<meta name="author" content="wangyupeng">
	<title>创建折扣帐户</title>
	<script language="javascript" src="../script/print.js" type="text/javascript"></script>
	<script language="javascript" src="../script/common.js" type="text/javascript"></script>
	<!--动态js-->
	<script language="javascript" type="text/javascript">
		function load(){
			Eui.showNavigation();
			setPages(["createcompanydiv","detview"]);
			CardMgnt.customer.show("companycustomerdiv",null,CardMgnt.COMPANYALL);
			CardMgnt.cardUser.show("companyuserdiv",null,CardMgnt.COMPANYALL,{contract:true});
		}
		function saveCompany(){
			if (!checkForm(CardMgnt.customer.formName)) return;
			if (!checkForm(CardMgnt.cardUser.formName)) return;
			
			if (!showQuestion("是否保存单位帐户？")) return;
			var cc = CardMgnt.customer.get();
			var cu = CardMgnt.cardUser.get();
			cu.status = CardUserStatus.UNACTIVATED;
			DWR.call("customerService.saveContractCustomerAndUser",cc,cu,function(result){
				showInformation("单位客户信息保存成功，审核通过后可以正常使用");
				//TODO 打印单位建档凭证
				onCancel();
			},{blockScreen:true});
		}
		
		function onCancel(){
			switchPage("createcompanydiv");
			CardMgnt.resetForm(CardMgnt.customer.formName);
			CardMgnt.resetForm(CardMgnt.cardUser.formName);
		}
	</script>
</head>
<body onload="load()">
	<!--页面导航-->
	<div class="nav"><div id="nav">&nbsp;</div></div>
	<div id="createcompanydiv">
		<div id="companycustomerdiv" class="form">
		</div>
		<div id="companyuserdiv" class="form">
		</div>
		<p>
			<button onclick="saveCompany()">保 存</button>
			<button onclick="onCancel()">取 消</button>
		</p>
	</div>
	<div id="detview" style="display:none;">
	</div>
</body>
</html>